/*
 * Copyright (C) 2017-2018 Alibaba Group Holding Limited. All Rights Reserved.
 *
 *
 * Licensed under the Apache License, Version 2.0 (the License);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef ALIOS_TTS_LISTENER_H_
#define ALIOS_TTS_LISTENER_H_

namespace alios {
class TTSEngineListener {
public:
    /** 请求成功 */
    static const int SUCCESS = 1000;
    /** 请求格式有误 */
    static const int ERROR_REQUEST_FORMAT = 4400;
    /** 需要鉴权信息 */
    static const int ERROR_NEED_AUTH_INFO = 4401;
    /** 鉴权失败 */
    static const int ERROR_AUTH_FAIL = 4403;
    /** 超出最大并发量 */
    static const int ERROR_BEYOND_MAXIMUM = 4429;
    /** 请求超时 */
    static const int ERROR_TIME_OUT = 4408;
    /** 处理出错 */
    static const int ERROR_REMOTE = 4500;
    /** 服务不可用 */
    static const int ERROR_REMOTE_INVALID = 4503;
    /** 本地网络异常 */
    static const int ERROR_DEVICE_NETWORK = -200;
    /** 写文件失败 */
    static const int ERROR_IO_FAILED = -300;
public:
    virtual ~TTSEngineListener() {};
    /**
    * @brief tts认证结果
    * @param status 认证结果，true表示成功， false表示失败
    * @return
    */
    virtual void OnAuthResult(const std::string& vendor, bool status) = 0;
    /**
    * @brief 获取云端tts音频的回调函数
    * @param value 云端tts音频数据和数据长度
    * @return
    */
    virtual void OnVoiceData(const char* data, int length) = 0;
    /**
    * @brief 云端tts音频数据获取完毕
    * @param
    * @return
    */
    virtual void OnComplete() = 0;
    /**
    * @brief 获取云端tts音频数据失败
    * @param value 错误码和错误提示
    * @return
    */
    virtual void OnError(int errorCode, const std::string& msg = "") = 0;
    /**
    * @brief 获取云端密钥
    * @param secretValue 云端密钥
    * @return 获取成功或失败
    */
    virtual bool OnAppKeyUpdate(const std::string& vendorName, std::string& secretValue) = 0;
};
}

#endif //ALIOS_TTS_LISTENER_H_
